package fr.starn.domoticz_widgets.JSonObject;

import java.util.ArrayList;
import java.util.List;

import com.google.gson.Gson;
import com.google.gson.GsonBuilder;

public class DevicesProps {
	   private String DashboardType;
	   private String MobileType;
	   private String WindScale;
	   private String WindSign;
	   private List<DeviceProps> result;
	public String getDashboardType() {
		return DashboardType;
	}
	public void setDashboardType(String dashboardType) {
		DashboardType = dashboardType;
	}
	public String getMobileType() {
		return MobileType;
	}
	public void setMobileType(String mobileType) {
		MobileType = mobileType;
	}
	public String getWindScale() {
		return WindScale;
	}
	public void setWindScale(String windScale) {
		WindScale = windScale;
	}
	public String getWindSign() {
		return WindSign;
	}
	public void setWindSign(String windSign) {
		WindSign = windSign;
	}
	public List<DeviceProps> getResult() {
		return result;
	}
	public void setResult(List<DeviceProps> result) {
		this.result = result;
	}

	public static DevicesProps deserialize(String serializedString){
        Gson gson = new GsonBuilder().create();
        
//        List<DeviceProps> result = new ArrayList<DeviceProps>();
        DevicesProps jsonProps = gson.fromJson(serializedString, DevicesProps.class);
//        for (DeviceProps jsonProp: jsonProps.getResult()){
//        	//if ( jsonProp.getName().equals(props.getDevice())){
//        		
//        		result.add(jsonProp);
////        	} else if ( props.getDevice()==null && jsonProp.getType().startsWith("Temp") || jsonProp.getSwitchType().equals("On/Off")){
////        		//result+=jsonProp.getName()+";";
////        		result.add(jsonProp);
////        	}
//        }
        return jsonProps;
	}
	
	public String serialize(){
		Gson gson = new GsonBuilder().create();
		return gson.toJson(this);
	}
}
